﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using Htss.Platform;
using Htss.Platform.Data;
using Htss.Platform.WebApi;

namespace DreamBox.Api.posts
{
    public class listBox:ApiBox
    {
        public ActionResult get()
        {
            int p = RequestContext.RouteData.Values["p"] != null ? Htss.Platform.Core.Transform.GetInt(RequestContext.RouteData.Values["p"].ToString(), 1) : 1;
            int id = RequestContext.RouteData.Values["id"] != null ? Htss.Platform.Core.Transform.GetInt(RequestContext.RouteData.Values["id"].ToString(), 0) : 0;
            string where = string.Empty;
            if (id != 0)
            {
                where = "CID=" + id;
            }
            //加载分类数据
            DAL.PSelect ps = new DAL.PSelect();
            
            //分页数据处理
            DAL.GetPager page = new DAL.GetPager();
            DataTable dt= page.GetFormPageData(p, "dbox_v_posts", "PostsID", where, 1);
            return Json(true, Htss.Platform.Core.Json.ToJson(dt));
        }
    }
}